<template>
  <div>
    <HmListItem :records="records" :isShow="isShow" @shows="shows" @getDialog="getDialog" />
    <HmDialog v-if="isShow" @isShows="isShows" :records="records" :listItem="itemList" />
  </div>
</template>

<script>
import HmListItem from "./components/HmListItem.vue";
import HmDialog from "./components/HmDialog.vue";
export default {
  data() {
    return {
      records: [
        {
          date: "2022-01-01",
          doctor: "张三",
          diagnosis: "感冒",
          prescription: "感冒药",
        },
        {
          date: "2022-02-01",
          doctor: "李四",
          diagnosis: "头疼",
          prescription: "止疼药",
        },
        {
          date: "2022-03-01",
          doctor: "王五",
          diagnosis: "腰痛",
          prescription: "止痛贴",
        },
      ],
      isShow:false,
      itemList:[]
    };
  },
  components: {
    HmListItem,
    HmDialog
  },
  methods:{
    shows(){
      this.isShow=true
    },
    isShows(){
      this.isShow=false
    },
    getDialog(data){
      this.itemList=data
      // console.log(this.itemList);
    }
  }
};
</script>

<style></style>
